#!/usr/bin/env bash

set -e

export GOPATH=~/go
rm -rf $GOPATH/pkg/*

go get -d github.com/cloudfoundry/cf-acceptance-tests/
export CATSPATH=$GOPATH/src/github.com/cloudfoundry/cf-acceptance-tests

rm -f $CATSPATH/gcf
curl https://s3.amazonaws.com/go-cli/builds/cf-linux-amd64 > $CATSPATH/gcf
chmod u+x $CATSPATH/gcf

export PATH=$PATH:$CATSPATH

cd $CATSPATH
git checkout master

export CONFIG=$CATSPATH/config.json

local_gopath=$CATSPATH/Godeps/_workspace

mkdir -p $local_gopath/bin

export GOPATH=$local_gopath:$GOPATH
export PATH=$local_gopath/bin:$PATH

go install -v github.com/onsi/ginkgo/ginkgo
echo "CATS STRAPPED WITH GATS"
ginkgo -r -slowSpecThreshold=120 -skip="go makes the app reachable via its bound route|SSO|takes effect after a restart, not requiring a push|doesn't die when printing 32MB"
